import java.io.*;
import java.util.*;

public class SpaceEmergency {
	public static void main(String args[]){
		try{
			Scanner sc = new Scanner(new File("A-large.in"));//入力ファイル
			PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(new File("solve.in"))));//出力ファイル
			int T = sc.nextInt();//ループ回数
			for(int i=1;i<=T;i++){
				int L = sc.nextInt();
				int t = sc.nextInt();
				int N = sc.nextInt();
				int C = sc.nextInt();
				int[] longer = new int[C];
				int[] alllong = new int[N];
				int sumlong = 0;
				int maxlong=0;
				for(int j=0;j<C;j++){
					longer[j]=sc.nextInt();
					if(longer[j]>maxlong){
						maxlong=longer[j];
					}
				}
				for(int j=0;j<N;j++){
					alllong[j]=longer[j%C];
					sumlong += alllong[j];
				}
				int[] otherlonger = new int[C];
				for(int j=0;j<C;j++){
					otherlonger[j] = longer[(N+j)%C];
				}
				
				int loop;
				int loopC = N/C;
				if(loopC<L)loop=loopC;
					else loop=L;
				int avL = L/loop;
				int anL = L%loop;
				int[] use = new int[L];
				for(int j=0;j<L;j++)use[j]=0;
				int time = 0;
				double place =0.0;

				if(N%C!=0){
					for(int j=0;j<N%C;j++){
						time += alllong[j]*2;
					}
				}
				for(int j =0;j<loop;j++){
					
				}
				
				int value = sumlong*2;
				for(int j=0;j<L;j++)value -= use[j];
				pw.println("Case #"+i+": "+value);//出力
			}
			pw.close();
		}catch(FileNotFoundException e){
			System.out.println(e);
		}catch(IOException e){
			System.out.println(e);			
		}
	}

}
